
const app = {
  namespaced: true,
  state: {
    // 全局的加载 loading
    globalLoading: false,
    // 弹框确定加载标识
    modalLoading: false,
    // 全局消息
    message: "",
    // 全局消息状态
    messageStatus: "",
    // 按钮权限
    permission_btn_code: [],
    // 菜单权限
    permission_menu_code: [],
    // 角色
    roles: [],
  },
  mutations: {
    // 设置权限
    SET_PERMISSION(state, permission) {
      const { btnCode, menuCode, roles } = permission || {}
      state.permission_btn_code = btnCode
      state.permission_menu_code = menuCode
      state.roles = roles
    },
    // 设置全局加载标识
    SET_GLOBAL_LOADING(state, loadingFlag) {
      state.globalLoading = loadingFlag
    },
    // 弹框确定加载标识
    SET_MODAL_LOADING(state, loadingFlag) {
      state.modalLoading = loadingFlag
    },
    // 设置全局消息
    SET_MESSAGE(state, { message, status }) {
      state.message = message
      state.messageStatus = status
    }
  },

}

export default app
